package org.genko.model;

import java.io.*;
import org.w3c.dom.*;
/***
 * Represents a group of models and their definitions (Model Schemas and Object Models)
 * Scheme is the root of all attached member objects
 * @author Israel Chapa
 */
public interface Scheme extends MemberObject
{
	/**
	 * Gets the registered schemas of this Scheme
	 * @return The registered schemas of this Scheme
	 */
	MemberTypeCollection getModelSchemas();
	/**
	 * Gets the current object models which belongs to this Scheme
	 * @return the model members of this Scheme
	 */
	MemberCollection getModelObjects();
	/**
	 * Gets the registered ModelSchema with the given name
	 * @param name The name of the Schema
	 * @return the registered ModelSchema with the given name
	 */
	ModelSchema getModelSchema(String name);
	/**
	 * Registers the given schema in this Scheme
	 * @param schema the schema to register
	 */
	void registerSchema(ModelSchema schema);
	/**
	 * Removes the schema with the given name
	 * @param schemaName The name of the ModelSchema to remove
	 */
	void removeSchema(String schemaName);
	/**
	 * Creates an instance object with the given qualified name of the type
	 * @param typeQualifiedName The qualified name of the type
	 * @return the new instance of the object of the specified type
	 */
	MemberObject createObject(String typeQualifiedName);
	/**
	 * Creates an instance object of the given type
	 * @param type The type of the object to create
	 * @return The new instance of the object of the specified type
	 */
	MemberObject createObject(MemberType type);
	/**
	 * Creates an object model of the given schema
	 * @param schema The ModelSchema of the object model to create
	 * @return the new object model of the specified schema
	 */
	MemberObject createModel(ModelSchema schema);
	/**
	 * Parses an object from an input stream
	 * @param input The input to parse
	 * @return The object parsed
	 */
	MemberObject parseObject(InputStream input);
	/**
	 * Parses an object from an input stream
	 * @param type The expected type
	 * @param input The input to parse
	 * @return The created object
	 */
	MemberObject parseObject(MemberType type, InputStream input);
	/**
	 * Writes this scheme in the given output
	 * @param output The output to write
	 */
	void writeScheme(OutputStream output);
	/**
	 * Creates a new document with this scheme data
	 * @return A new document with this scheme data
	 */
	Document toXmlDocument();
}